import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.io.IOException;

/**
 * Created by Administrator on 2016/3/10.
 */
public class ApiTest {

    public static void main(String[] args) throws IOException {
        Configuration conf = new Configuration();
        FileSystem fs = FileSystem.get(conf);
        Path p1 = new Path("hdfs://172.17.0.7:9000/user/root/input/file1.txt");
        Path p2 = new Path("hdfs://172.17.0.7:9000/user/root/input/file3.txt");
        fs.rename(p1, p2);
        fs.close();//释放资源
        System.out.println("重命名文件夹或文件成功.....");
    }

}
